import { getChannelList, updateSaasCompany } from '@/api/company'

import { Modal, message } from 'ant-design-vue'
import { Component, Emit, Prop, Watch } from 'vue-facing-decorator'
import Render from '@/render/Render'
import renderModal, {
    getModelValue,
    initModelValue,
    renderForm,
    type FormModalDto
} from '@/components/modal/Modal'
import toNative from '@/utils/toNative'
import { getReceiptData } from '@/utils/util'
import type { CompanyInfoDto } from '@/api/company/types'
import type { LongInsuranceCaseListDto,ReportCaseResultDto } from '@/api/insurance/period/types'
import { getKeyToEnum, InsuranceIndemnifyEnum } from '@/const/enum'
import { setPeriodInsurClaim,setDailyInsurClaimOne,setDailyInsurClaimTwo } from '@/api/insurance/period'
@Component
export class EditInfoPop extends Render {
    showModal = false
    @Prop({ default: false }) show!: boolean
    @Prop() basicInfo!: LongInsuranceCaseListDto<ReportCaseResultDto>
    @Emit('update:show')
    showChange(val: boolean) {return val}

    @Emit('refresh')
    handleRefresh() {}

    @Watch('show', { immediate: true })
    async handleWatchShow() {
        this.formConfig.show = this.show
        this.showModal = this.show
        if (this.show) {
            initModelValue(this.formConfig, this.basicInfo)
        }
    }
	
    @Watch('formConfig.show', { immediate: true })
    handleWatchShowDialog() {
        this.showChange(this.formConfig.show)
    }

    formConfig = this.initFormConfig() as FormModalDto

    initFormConfig() {
        return {
            title: '编辑资料',
            theme: 'dark',
            show: false,
            params: {
                confirmText:'确定',
            },
            items: {
                isVisible: {
                    name: '归属销售',
                    element: 'select',
                    required: true,
                },
                isVis: {
                    name: '收款渠道',
                    element: 'select',
                    required: true,
                },
                isV: {
                    name: '收款账户',
                    element: 'select',
                    required: true,
                },
            },
            complete: async () => {
                const data = getModelValue(this.formConfig)
            },
            cancel: () => {}
        } as FormModalDto
    }
	
    

    render() {
        return <>
            { renderModal(this.formConfig) }
        </>
    }
}

export default toNative<{  }, { refresh: () => void }>(EditInfoPop)
